// pages/management/employee/employee.js
Page({
  /**
   * 页面的初始数据
   */
  data: {
    active: 0,
    tabList: [
      {
        title: "人员管理",
        component: "personnelManagement"
      },
      {
        title: "工资管理",
        component: "salaryManagement"
      }
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {},

  onChange(e) {
    this.setData({
      active: e.detail.index
    });
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    const personnel_management = this.selectComponent(".personnel_management");
    const salary_management = this.selectComponent(".salary_management");
    if (personnel_management) {
      personnel_management.onPullDownRefresh && personnel_management.onPullDownRefresh();
    } else if (salary_management) {
      salary_management.onPullDownRefresh && salary_management.onPullDownRefresh();
    } else {
      wx.stopPullDownRefresh();
    }
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    const personnel_management = this.selectComponent(".personnel_management");
    const salary_management = this.selectComponent(".salary_management");
    if (personnel_management) {
      personnel_management.onReachBottom && personnel_management.onReachBottom();
    } else if (salary_management) {
      salary_management.onReachBottom && salary_management.onReachBottom();
    }
  }
});
